<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.ArrayList"%>
<%-- Set the content type header with the JSP directive --%>

<%@ page contentType="application/vnd.ms-excel" %>
    <%
    String fileNames = (String) request.getSession().getAttribute("fileNameFromAction"); 
    %>                                                                                                                   
<%-- Set the content disposition header --%>
<%
response.setHeader("Content-Disposition", "attachment; filename="+fileNames.substring(0,fileNames.indexOf("."))+".xls");
%>

<html>
<body>
<%
    HashMap hashMapListOfFiles = (HashMap)request.getSession().getAttribute("hashMapListOfFiles");
    HashMap mapOfInputFastaFile = (HashMap)request.getSession().getAttribute("mapOfInputFastaFile");  
    
    %><table align="left" cellspacing="2" border="true" width="100"><%
    HashMap tempJoinHashMap = (HashMap)hashMapListOfFiles.get(fileNames);
    Iterator itrJoinHashMap = tempJoinHashMap.keySet().iterator();
    int iCount = 1;
    %><tr><td><p><strong>No.</strong></p></td><%
    %><td><p><strong>Accession Number</strong></p></td><%
    %><td><p><strong>Description</strong></p></td><%
    %><td><p><strong>Proteins in each cluster</strong></p></td><%
    %></tr><%
   
         while(itrJoinHashMap.hasNext()) {
        String iDForRef = (String)itrJoinHashMap.next();
        ArrayList tempArrayList = (ArrayList)tempJoinHashMap.get(iDForRef);
        Iterator itrTempArrayLst = tempArrayList.iterator();
        int jCount = 0;
        while(itrTempArrayLst.hasNext()) { 
            String tempAccNo = (String)itrTempArrayLst.next();
            String tempSeqAndDesc[] = (String[])mapOfInputFastaFile.get(tempAccNo); 
        if(jCount == 0) {    
        %><tr><td><%=iCount%></td><% 
        %><td><%=tempAccNo%></td><% 
        %><td><%=tempSeqAndDesc[0]%></td><%
        %><td><%=(tempArrayList.size()-1)%></td><%
        %></tr><%
        }
        if(jCount!=0){
        %><tr><td colspan="3"><table id="table<%=iCount%>" border="true" align="center"><% 
         %><tr><td>&nbsp;</td><%
        %><td bgcolor="#E0ECF8"><%=tempAccNo%></td><% 
        %><td bgcolor = "#E0ECF8"><%=tempSeqAndDesc[0]%></td><%
        %></tr><%
        %></table></td></tr><% 
        }
        jCount++; 
        } 
        iCount++;
        }
%></table>
</body>
</html>